#ifndef QUDPCONTROL_H
#define QUDPCONTROL_H

#include "UDPBase.h"
#include <QTimer>
#include <QUdpSocket>
#include <QObject>

class QUDPControl : public QObject,public UDPBase
{
    Q_OBJECT
public:
    explicit QUDPControl();

    virtual void ConnectToHost() override;
    virtual void ReConnectToHost() override;
    virtual void DisConnectToHost() override;
    virtual void WriteBuff(const char*) override;

private:

    QUdpSocket * us;
    bool         sendFlag;  // false 不发送 true 发送
    QByteArray   sendBuf;   //UDP发送缓存区
    QHostAddress robotAddr; //UDP机器人地址
    quint16      robotPort; //UDP机器人端口
private slots:
    void recvData();
};

#endif // QUDPCONTROL_H
